package com.youpai.platform.vulture.service.event;

import com.youpai.platform.vulture.service.enums.VultureChannelEventEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @date: 2022/7/10 21:31
 * @author: Anna
 * @version: 1.0
 * @description: vultureChannel事件消息
 */
@Data
@Accessors(chain = true)
public class VultureChannelEvent {

    /**
     * 事件类型
     */
    private int eventType;

    /**
     * 事件code
     */
    private String eventCode;

    /**
     * 消息
     */
    private String msg;

    /**
     * 触发时间
     */
    private Date touchTime;

    /**
     * 消息内容
     */
    private Object content;

    private VultureChannelEvent() {
    }

    public static VultureChannelEvent build(VultureChannelEventEnum vultureChannelEventEnum, Object content) {
        return new VultureChannelEvent()
                .setEventCode(vultureChannelEventEnum.eventCode)
                .setEventType(vultureChannelEventEnum.eventType)
                .setMsg(vultureChannelEventEnum.msg)
                .setTouchTime(new Date())
                .setContent(content);
    }
}
